package com.shiwaixiangcun.monitor.domain;


import com.rabbit.spring.data.domain.BaseEntity;
import com.shiwaixiangcun.monitor.enums.HealthStatus;
import com.shiwaixiangcun.monitor.enums.Sex;
import com.shiwaixiangcun.monitor.enums.WarningServiceType;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/7/12.
 */
@Entity
@Table(name = "ms_early_warning")
@DynamicUpdate
@DynamicInsert
public class EarlyWarning extends BaseEntity<Long> {

    private String number;
    private String identifier;  //标识用户或者设备的唯一标识 uuid

    @OneToMany
    @JoinColumn(name = "early_warning_id")
    private List<WarningContent> warningContents = new ArrayList<>();

    private Boolean isBeeper=false;//是否是呼叫器预警

    private String name;   //名字或者位置别名
    private String phone;
    private String avatar;//头像
    private Integer age;

    @Enumerated(EnumType.STRING)
    private Sex sex = Sex.NONE;

    //高德地图坐标
    private String longitude; //经度
    private String latitude;  //纬度

    @Enumerated(EnumType.STRING)
    private HealthStatus status;//状态

    @Enumerated(EnumType.STRING)
    private WarningServiceType serviceType = WarningServiceType.None;

    private String dealResult; //处理结果 => serviceType=Offline_Processing("情况紧急，已线下处理")

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "work_order_id")
    private WorkOrder workOrder;  // serviceType=Workorder("服务工单")

    private Boolean play=false;

    public Boolean getPlay() {
        return play;
    }

    public void setPlay(Boolean play) {
        this.play = play;
    }

    public Boolean getBeeper() {
        return isBeeper;
    }

    public void setBeeper(Boolean beeper) {
        isBeeper = beeper;
    }

    public List<WarningContent> getWarningContents() {
        return warningContents;
    }

    public void setWarningContents(List<WarningContent> warningContents) {
        this.warningContents = warningContents;
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getIdentifier() {
        return identifier;
    }

    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Sex getSex() {
        return sex;
    }

    public void setSex(Sex sex) {
        this.sex = sex;
    }

    public String getLongitude() {
        return longitude;
    }

    public void setLongitude(String longitude) {
        this.longitude = longitude;
    }

    public String getLatitude() {
        return latitude;
    }

    public void setLatitude(String latitude) {
        this.latitude = latitude;
    }

    public WarningServiceType getServiceType() {
        return serviceType;
    }

    public void setServiceType(WarningServiceType serviceType) {
        this.serviceType = serviceType;
    }

    public String getDealResult() {
        return dealResult;
    }

    public void setDealResult(String dealResult) {
        this.dealResult = dealResult;
    }

    public WorkOrder getWorkOrder() {
        return workOrder;
    }

    public void setWorkOrder(WorkOrder workOrder) {
        this.workOrder = workOrder;
    }

    public HealthStatus getStatus() {
        return status;
    }

    public void setStatus(HealthStatus status) {
        this.status = status;
    }
}
